'use strict'
const db = uniCloud.database()
exports.main = async (event, context) => {
	const collection = db.collection('rank')
	const { nickname, threshold, create_date } = JSON.parse(event.body)
	if(nickname.length <= 50 && parseInt(threshold) <= 50 && parseInt(create_date) >= 1612533990000 && parseInt(create_date) <= 2527682790000) {
		var res = await collection.add(JSON.parse(event.body))
		return '上传成功'
	} else {
		return '数据有误，上传失败'
	}
}

